package com.zhuiyun.project;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import tk.mybatis.spring.annotation.MapperScan;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 *
 * MapperScan 中如果时多个包可以使用数据 如：@MapperScan({"com.zhuiYun.project.*.mapper","com.zhuiYun.project.*.mapper"})
 * 项目启动类  本项目将作为模板项目
 * 技术包括 springboot+tk_mybatis+mybatis+mysql+redis+druid+spring security + jwt + swagger  mq + es
 */
@EnableScheduling
@SpringBootApplication
@MapperScan({"com.zhuiyun.project.api.*.mapper","com.zhuiyun.project.api.*.*.mapper","com.zhuiyun.project.api.system.*.mapper"})
public class ManageApplication  implements ServletContextInitializer {
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
    public static void main(String[] args) {
        SpringApplication.run(ManageApplication.class, args);
    }
	/**
     * 在线客服的发送文件大小
     * 在原来的启动类中实现ServletContextInitializer接口并设置发送内容大小限制(25MB)
     * @param servletContext
     * @throws ServletException
     */
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize","26214400");
    }

}
